package com.wuwei.aliocr.controller;


import com.wuwei.aliocr.domain.Authorization;
import com.wuwei.aliocr.domain.Teacher;
import com.wuwei.aliocr.result.Result;
import com.wuwei.aliocr.service.AuthorizationService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping(value="/authorization")
@CrossOrigin
public class AuthorizationListController {

    @Resource
    private AuthorizationService authorizationService;

    /**
     * 根据授权类型查询拥有相应授权的教员
     * @param authorization
     * @return
     * @throws Exception
     */
    @GetMapping("list/{authorization}/{teacher}")
    public Result<List<Teacher>> getListByAuthorization(@PathVariable("authorization") String authorization,@PathVariable("teacher") String teacher) throws Exception {
        List<Teacher> list = authorizationService.getByAuthorization(authorization,teacher);
        return Result.ok(list);
    }

}
